package logic

import (
	"context"
	"useryk/userrpc/userrpc"

	"useryk/api/internal/svc"
	"useryk/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ProductLikeListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewProductLikeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProductLikeListLogic {
	return &ProductLikeListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ProductLikeListLogic) ProductLikeList(req *types.ProductLikListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line

	productlikelist, err := l.svcCtx.UserRpc.ProductLikeList(l.ctx, &userrpc.ProductLikeListRequest{})
	if err != nil {
		return &types.Response{
			Code:    0,
			Message: err.Error(),
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Code:    200,
		Message: "产品排行榜展示成功",
		Data:    productlikelist,
	}, nil

}
